<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/register.css">
    <script src="../js/lib/jquery.js"></script>
</head>
<body>
    <!-- 天猫 -->
    <div class="header" >
        <a href="//www.tmall.com" title="天猫Tmall.com" target="_top">
            <img class="tm-logo" src="//img.alicdn.com/tfs/TB1_Gn8RXXXXXXqaFXXXXXXXXXX-380-54.png">
        </a>
    
  </div>

  <div class="content">
        
    <div id="login-banner-wrap" style="width: 100%; background-color: rgb(221, 39, 38);" title="上天猫，就够了">
        <div class="inner">
            <img src="//gw.alicdn.com/tfs/TB1kcCBSpXXXXarapXXXXXXXXXX-1190-600.png" alt="">
            <a href="//www.tmall.com"></a>
        </div>
    </div>

<div class="form">
    <div class="form-1">
        <h2 class="form-1-x">用户注册</h2>
    </div>

    <div class="form-2">
        <!-- 用户名 -->
        <input name="fm-login-id" type="text" class="fm-text" id="fm-login-id"  placeholder="会员名/邮箱/手机号" >
    
         <!-- 密码 -->
        <input name="fm-login-password" type="password" class="fm-text" id="fm-login-password" placeholder="请输入登录密码" >
    

        <!-- 登录 -->
        <button type="submit" tabindex="3" class="fm-button fm-submit password-login">注册</button>

      
    </div>
    

   
</div>
</div>
</div>

<div id="regbot"></div>
<!-- 页面引入 -->
<script>
    $("#regbot").load("../html/bottom.html");
</script>


<!-- 注册接口 -->
<script>
    $(function(){
        $('.fm-submit').click( function () { 
          let Uname=$('#fm-login-id').val();
          let Upass=$('#fm-login-password').val();
          $.ajax({
            type: "get",
            url: "http://jx.xuzhixiang.top/ap/api/reg.php",
            data: { username: Uname,password:Upass },
            success: function (data) {
                foo(data)
            }
          })
          
            function foo (data){
            if($('#fm-login-id').val()==""){
              alert('请输入用户名')
          }else{
            if(data.code==1){
                alert('注册成功')
                window.location.replace(url='register.html?id='+data.msg)
            }else{
                alert('用户名已存在')
            }
          }
           
          }
          

        });
    })

</script>
</body>
</html>